package com.wangzd.springcloud.service;

import com.wangzd.springcloud.data.CommonResult;
import com.wangzd.springcloud.entity.Payment;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author wangzd
 * @date 2021/1/25 16:22
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")// 被调用微服务的服务名
public interface PaymentFeignService {

    /**
     * 对应8001 PaymentService的getPaymentById接口
     *
     * @param id
     * @return
     */
    /*public Payment getPaymentById(@Param("id") Long id);*/

    /**
     * 对应8001 PaymentController 的getPaymentById接口
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/feign/timeout")
    public String paymentFeignTimeout();
}
